This page last changed on Jun 16, 2009 by mccann.

This is the procedure to take when OSG swaps an instrument on an OASIS mooring in order to keep the metadata and data all lined up in SSDS. The easiest way is to try to do these steps exactly when they actually do the instrument swap. The reason is that due to the fact that the data from the instrument is downloaded to the same file in the OASIS directory so there is no way (currently) to automate some sort of notice that the instrument has been swapped. An external process reads that raw data file from the instrument, looks up the device ID from a shore-side configuration file and then publishes that data to SSDS under that device ID. If the timing is not right, some extra steps need to be taken. These steps will assume that the timing is correct and I will add steps at the end in case this is being done after the swap happened (usually the case).

  1. Get new device ID of the new instrument to be installed.
  2. Check out the XML for that instrument from the 'puckxml' project in CVS.
  3. Use a validating XML editor like XML Spy, oXygen, or jEdit to open the XML file.
  4. Make sure the schema location at the top of the XML file points to:
    1. http://new-ssds.mbari.org/ssds-docs/xml/schema/SSDS_Metadata.xsd
  5. Run the editor's validation on the XML.
  6. If it does not validate, fix errors
  7. Remove any deployment attributes from the <Deployment> tag. For instance any nominalLat/Lon/Depth. The one exception is the nominalDepth, if it is known please set it.
  8. If the <Deployment> tag has a 'name' attribute, make sure it does not have any deployment specific information in it. For example, 'ISUS Deployment' is better than 'M2 ISUS Deployment'. The reason for removing any deployment information from the XML is so that when the device moves to a different mooring, the user should not have to edit the XML. The goal is to get all the XML to a point where it never needs to be edited when an instrument is deployed (unless something in the way the data stream is generated from the instrument changes).
  9. Go to the SSDS Device pages and verify that the all the device information (mfg, model, serial number, name, type, etc.) matches what is currently in SSDS. If any of those are different it will update the device information in SSDS when the XML comes in the data stream.
  10. Verify RecordDescription and RecordVariables look correct. I usually go to the raw data pages in SSDS and bring up the last few packets from the device just to verify that the number of columns and bufferSeparator look about right.
  11. Check any changes to the XML back into CVS.
  12. Copy the XML to the \\Tornado\ssdsdata\mooring(m1|m2)\YYYY\xml directory
  13. Go to the \\Tornado\ssdsdata\mooring(m1|m2)\YYYY\cfg directory.
  14. This next step is the one that needs to be timed with the mooring turn. When the old instrument is shutdown:
    1. Open the ssds.cfg file in a text editor
    2. Find the line that shows the currently deployed instrument and copy it to a line just below it. For example, if we are replacing the GPS, it might look like this before:
      Before Copy
      instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
      instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
      instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
      instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
      instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
      

      and this after:

      After Copy
      instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
      instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
      instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
      instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
      instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
      instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
      
  15. Now change the new line to have the correct device ID and the correct XML file URL
    After Device ID update
    instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
    instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
    instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
    instrument = GPS_TYPE3,1511,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1511.xml,,,TransformGPS
    instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
    instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
    
  16. To clean up the previous deployment information, put start and end dates after the XML URL
    After Adding Start/End dates
    instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
    instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
    instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,2007/04/25 16:21:58,2007/08/01 10:00:00,TransformGPS
    instrument = GPS_TYPE3,1511,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1511.xml,,,TransformGPS
    instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
    instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
    

    (Be careful on the format for the start and end date strings.  Leading 0s are required.)

  17. Save the cfg file.
    Saving the file will make the change take hold
    When the ssds.cfg file changes (saved) is when the OASIS2SSDS processing will pick up the instrument change. Now, the next time it runs it will pick up the instrument change, grab the XML file from the 'xml' directory and publish it to SSDS. It will then publish all data under the new device ID.
  18. Edit the metadata in SSDS to put a close date on the old instrument deployment in SSDS. Currently I do that using Enterprise Manager.
If this is being done after the fact the next steps will also need to be taken.
  1. After the new deployment shows up in SSDS (which can take up to 5 minutes after the OASIS2SSDS has completed), the start time for the new deployment will need to be edited to match the actual time the instrument was swapped.
  2. Also because the data was being published under the incorrect device ID, it will need to be moved from one database table in SSDS_Data on Solstice to another table.
    1. The first thing that I do is grab the timestamp from the last packet sent from the old device in the raw data page on SSDS.
    2. For example, I go to: http://new-ssds.mbari.org:8080/ssds/siamRawDataStep1.jsp and enter the old device ID and set the number of packets back to make sure it goes far enough back to cover the actual time of the instrument swap. Then click on 'Next->'.
    3. Once the raw data shows up, find the last packet from the old device and grab the 'SIAM Timestamp' value (not the date/time) as that will be used in the Enterprise Manager query.
    4. Open Enterprise Manager and navigate to the 'SSDS_Data' database on Solstice.
    5. Browse the tables and find the table with the device ID of the old device and right click on it and select 'Open Table->Return all rows'.
    6. Click on the 'SQL' button in Enterprise Manager to bring up the SQL pane. It should show the basic query which should look something like this:
      SELECT     *
      FROM         [1416]
      
    7. Now add the where clause to pick only the data that is after the timestamp you grabbed from the last packet on the web page.
      Timestamps in SQL are in Seconds
      A quick note here, the 'SIAM Timestamp' on the raw data page is actually in milliseconds and the database column is in seconds so you will have to remove the last three digits of the 'SIAM Timestamp' before putting it in this query.
      SELECT     *
      FROM         [1416]
      WHERE timestampSeconds > 1185963023
      
    8. Run this query by clicking the run button '!' in Enterprise Manager.
    9. Look over the results to make sure they look about right (usually you are looking for the length of the return which should be much shorter). You can actually use a count query to see how many rows this query will return. A count query would look like:
      SELECT    count(*)
      FROM         [1416]
      WHERE timestampSeconds > 1185963023
      
    10. Once you know the query is correct (also compare sequence number in query return and the raw data page), copy it to the clipboard and close the query window in Enterprise Manager.
    11. Navigate to the table of the device you want to copy the data into and right click and select 'All Tasks->Import Data...' which will fire up the DTS wizard.
      1. Click on 'Next>'
      2. For the Data Source database choose Solstice
      3. Select the 'SSDS_Data' database (note you should have permissions to do all this and use your windows authentication)
      4. Click on 'Next>'
      5. The destination configuration should be already to go (Solistice and SSDS_Data database).
      6. Click on 'Next>'
      7. Select 'Use a query to specify the data to transfer'
      8. Click on 'Next>'
      9. Paste the query from your clipboard into the 'Query Statement' window (You can click on 'Parse' if you want a quick sanity check)
      10. Click on 'Next>'
      11. Click on the 'Results' entry under the 'Destination' column which will enable a drop down box.
      12. Choose the table of the newly installed device where you will be copying the data to.
      13. Click on 'Next>'
      14. Click on 'Next>'
      15. Click on 'Finish' which will copy the data.
      16. Once that is done, open the table of the old instrument and the SQL pane so that we can construct the delete query on the old data.
      17. Paste in the select query and verify it is the same data you copied over:
        SELECT     *
        FROM         [1416]
        WHERE timestampSeconds > 1185963023
        
      18. If it looks good, click on the 'Change Query type ...' button in Enterprise Manager and select 'Delete'. This will change the query to a delete query.
      19. Run the query by click on the run '!' button. That will remove all the data from the old instrument.

That's it ... whew!

Kevin Gomes (August 3, 2007)

Document generated by Confluence on Feb 04, 2026 08:56